package com.cc.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import com.cc.entity.annotation.Dog;
import com.cc.entity.annotation.User;
//@Configuration 相当于xml文件
@Configuration
// 下面相当于<context:component-scan base-package="com.cc.entity"/>
@ComponentScan("com.cc.entity.annotation")
public class AppConfig {
    @Bean(name="u1",initMethod = "setup")
    @Scope("prototype")
    public  User  getUser() {
        return new User(12,instanceDog());
    }
    @Bean(destroyMethod = "clearup")//默认名称为 方法名
    public Dog instanceDog() {
        return new Dog("拉布拉多","公");
    }
}




